<?php
namespace app\api\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
      'fullname'  => 'require',
      'idcard'   => 'require|min:18|idCard',
      'card1' => 'require',
      'card2' => 'require',
      'cname' => 'require',
      'ccode' => 'require',
      'phone' => 'require',
    ];

    protected $message = [
      'fullname.require' => '姓名必须填写',
      'idcard.require'     => '身份证号码必须填写',
      'idcard.min'     => '身份证号码不得小于18位',
      'idcard.idCard'     => '身份证号码格式不正确',
      'card1.require'     => '图片1必须上传',
      'card2.require'     => '图片2必须上传',
      'cname.require' => '公司名称必须填写',
      'ccode.require' => '信用代码必须填写',
      'phone.require' => '电话必须填写',
     
    ];

    // login 验证场景定义
    public function scenePersonalverify()
    {
      return $this->only(['fullname','idcard','card1','card2']);
    }  

    // register 验证场景定义
    public function sceneBusinessverify()
    {
      return $this->only(['fullname','phone','cname','ccode','card1']);
    } 


 
}